<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GstAudioClock: GStreamer Base Plugins 1.0 Library Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GStreamer Base Plugins 1.0 Library Reference Manual">
<link rel="up" href="gstreamer-audio.html" title="Audio Library">
<link rel="prev" href="GstAudioCdSrc.html" title="GstAudioCdSrc">
<link rel="next" href="GstAudioDecoder.html" title="GstAudioDecoder">
<meta name="generator" content="GTK-Doc V1.28 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#GstAudioClock.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
                  <a href="#GstAudioClock.object-hierarchy" class="shortcut">Object Hierarchy</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="gstreamer-audio.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="GstAudioCdSrc.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="GstAudioDecoder.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="GstAudioClock"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GstAudioClock.top_of_page"></a>GstAudioClock</span></h2>
<p>GstAudioClock — Helper object for implementing audio clocks</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="GstAudioClock.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a>
</td>
<td class="function_name">
<span class="c_punctuation">(</span><a class="link" href="GstAudioClock.html#GstAudioClockGetTimeFunc" title="GstAudioClockGetTimeFunc ()">*GstAudioClockGetTimeFunc</a><span class="c_punctuation">)</span> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClock-struct"><span class="returnvalue">GstClock</span></a> *
</td>
<td class="function_name">
<a class="link" href="GstAudioClock.html#gst-audio-clock-new" title="gst_audio_clock_new ()">gst_audio_clock_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a>
</td>
<td class="function_name">
<a class="link" href="GstAudioClock.html#gst-audio-clock-adjust" title="gst_audio_clock_adjust ()">gst_audio_clock_adjust</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a>
</td>
<td class="function_name">
<a class="link" href="GstAudioClock.html#gst-audio-clock-get-time" title="gst_audio_clock_get_time ()">gst_audio_clock_get_time</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GstAudioClock.html#gst-audio-clock-reset" title="gst_audio_clock_reset ()">gst_audio_clock_reset</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GstAudioClock.html#gst-audio-clock-invalidate" title="gst_audio_clock_invalidate ()">gst_audio_clock_invalidate</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GstAudioClock.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody><tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="GstAudioClock.html#GstAudioClock-struct" title="struct GstAudioClock">GstAudioClock</a></td>
</tr></tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GstAudioClock.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen">    <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GObject-struct">GObject</a>
    <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gobject/gobject-The-Base-Object-Type.html#GInitiallyUnowned">GInitiallyUnowned</a>
        <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstObject.html#GstObject-struct">GstObject</a>
            <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClock-struct">GstClock</a>
                <span class="lineart">╰──</span> <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSystemClock.html#GstSystemClock-struct">GstSystemClock</a>
                    <span class="lineart">╰──</span> GstAudioClock
</pre>
</div>
<div class="refsect1">
<a name="GstAudioClock.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gst/audio/audio.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="GstAudioClock.description"></a><h2>Description</h2>
<p><a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a> makes it easy for elements to implement a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClock-struct"><span class="type">GstClock</span></a>, they
simply need to provide a function that returns the current clock time.</p>
<p>This object is internally used to implement the clock in <a class="link" href="GstAudioBaseSink.html" title="GstAudioBaseSink"><span class="type">GstAudioBaseSink</span></a>.</p>
</div>
<div class="refsect1">
<a name="GstAudioClock.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="GstAudioClockGetTimeFunc"></a><h3>GstAudioClockGetTimeFunc ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a>
<span class="c_punctuation">(</span>*GstAudioClockGetTimeFunc<span class="c_punctuation">)</span> (<em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClock-struct"><span class="type">GstClock</span></a> *clock</code></em>,
                             <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>This function will be called whenever the current clock time needs to be
calculated. If this function returns <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GST-CLOCK-TIME-NONE:CAPS"><span class="type">GST_CLOCK_TIME_NONE</span></a>, the last reported
time will be returned by the clock.</p>
<div class="refsect3">
<a name="GstAudioClockGetTimeFunc.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>clock</p></td>
<td class="parameter_description"><p>the <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="GstAudioClockGetTimeFunc.returns"></a><h4>Returns</h4>
<p> the current time or <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GST-CLOCK-TIME-NONE:CAPS"><span class="type">GST_CLOCK_TIME_NONE</span></a> if the previous time should
be used.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-audio-clock-new"></a><h3>gst_audio_clock_new ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClock-struct"><span class="returnvalue">GstClock</span></a> *
gst_audio_clock_new (<em class="parameter"><code>const <a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *name</code></em>,
                     <em class="parameter"><code><a class="link" href="GstAudioClock.html#GstAudioClockGetTimeFunc" title="GstAudioClockGetTimeFunc ()"><span class="type">GstAudioClockGetTimeFunc</span></a> func</code></em>,
                     <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>,
                     <em class="parameter"><code><a href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> destroy_notify</code></em>);</pre>
<p>Create a new <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a> instance. Whenever the clock time should be
calculated it will call <em class="parameter"><code>func</code></em>
 with <em class="parameter"><code>user_data</code></em>
. When <em class="parameter"><code>func</code></em>
 returns
<a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GST-CLOCK-TIME-NONE:CAPS"><span class="type">GST_CLOCK_TIME_NONE</span></a>, the clock will return the last reported time.</p>
<div class="refsect3">
<a name="gst-audio-clock-new.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>name</p></td>
<td class="parameter_description"><p>the name of the clock</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>func</p></td>
<td class="parameter_description"><p>a function</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user data</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>destroy_notify</p></td>
<td class="parameter_description"><p><a href="/usr/share/gtk-doc/html/glib/glib-Datasets.html#GDestroyNotify"><span class="type">GDestroyNotify</span></a> for <em class="parameter"><code>user_data</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gst-audio-clock-new.returns"></a><h4>Returns</h4>
<p>a new <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a> casted to a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClock-struct"><span class="type">GstClock</span></a>. </p>
<p><span class="annotation">[<acronym title="Free data after the code is done."><span class="acronym">transfer full</span></acronym>]</span></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-audio-clock-adjust"></a><h3>gst_audio_clock_adjust ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a>
gst_audio_clock_adjust (<em class="parameter"><code><a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a> *clock</code></em>,
                        <em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a> time</code></em>);</pre>
<p>Adjust <em class="parameter"><code>time</code></em>
 with the internal offset of the audio clock.</p>
<div class="refsect3">
<a name="gst-audio-clock-adjust.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>clock</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>time</p></td>
<td class="parameter_description"><p>a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gst-audio-clock-adjust.returns"></a><h4>Returns</h4>
<p> <em class="parameter"><code>time</code></em>
adjusted with the internal offset.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-audio-clock-get-time"></a><h3>gst_audio_clock_get_time ()</h3>
<pre class="programlisting"><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="returnvalue">GstClockTime</span></a>
gst_audio_clock_get_time (<em class="parameter"><code><a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a> *clock</code></em>);</pre>
<p>Report the time as returned by the <a class="link" href="GstAudioClock.html#GstAudioClockGetTimeFunc" title="GstAudioClockGetTimeFunc ()"><span class="type">GstAudioClockGetTimeFunc</span></a> without applying
any offsets.</p>
<div class="refsect3">
<a name="gst-audio-clock-get-time.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>clock</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="gst-audio-clock-get-time.returns"></a><h4>Returns</h4>
<p> the time as reported by the time function of the audio clock</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-audio-clock-reset"></a><h3>gst_audio_clock_reset ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_audio_clock_reset (<em class="parameter"><code><a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a> *clock</code></em>,
                       <em class="parameter"><code><a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a> time</code></em>);</pre>
<p>Inform <em class="parameter"><code>clock</code></em>
 that future calls to <a class="link" href="GstAudioClock.html#GstAudioClockGetTimeFunc" title="GstAudioClockGetTimeFunc ()"><span class="type">GstAudioClockGetTimeFunc</span></a> will return values
starting from <em class="parameter"><code>time</code></em>
. The clock will update an internal offset to make sure that
future calls to internal_time will return an increasing result as required by
the <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClock-struct"><span class="type">GstClock</span></a> object.</p>
<div class="refsect3">
<a name="gst-audio-clock-reset.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>clock</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>time</p></td>
<td class="parameter_description"><p>a <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstClock.html#GstClockTime"><span class="type">GstClockTime</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="gst-audio-clock-invalidate"></a><h3>gst_audio_clock_invalidate ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
gst_audio_clock_invalidate (<em class="parameter"><code><a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a> *clock</code></em>);</pre>
<p>Invalidate the clock function. Call this function when the provided
<a class="link" href="GstAudioClock.html#GstAudioClockGetTimeFunc" title="GstAudioClockGetTimeFunc ()"><span class="type">GstAudioClockGetTimeFunc</span></a> cannot be called anymore, for example, when the
user_data becomes invalid.</p>
<p>After calling this function, <em class="parameter"><code>clock</code></em>
 will return the last returned time for
the rest of its lifetime.</p>
<div class="refsect3">
<a name="gst-audio-clock-invalidate.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>clock</p></td>
<td class="parameter_description"><p>a <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
</div>
<div class="refsect1">
<a name="GstAudioClock.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GstAudioClock-struct"></a><h3>struct GstAudioClock</h3>
<pre class="programlisting">struct GstAudioClock;</pre>
<p>Opaque <a class="link" href="GstAudioClock.html" title="GstAudioClock"><span class="type">GstAudioClock</span></a>.</p>
</div>
</div>
<div class="refsect1">
<a name="GstAudioClock.see-also"></a><h2>See Also</h2>
<p><a class="link" href="GstAudioBaseSink.html" title="GstAudioBaseSink"><span class="type">GstAudioBaseSink</span></a>, <a href="/usr/share/gtk-doc/html/gstreamer-1.0/GstSystemClock.html#GstSystemClock-struct"><span class="type">GstSystemClock</span></a></p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.28</div>
</body>
</html>